/**
 * Created by 34984 on 2017/3/26.
 */
function insertFun(){
   var age = document.getElementById('Iage').value;
   var sex = document.getElementById('Isex').value;
   var region = document.getElementById('Iregion').value;
   var income = document.getElementById('Iincome').value;
   var married = document.getElementById('Imarried').value;
   var car = document.getElementById('Icar').value;
   var mortgage = document.getElementById('Imortgage').value;
   var buy = document.getElementById('Ibuy').value;
    if(age!=""&&
        sex!=""&&
        region!=""&&
        income!=""&&
        married!=""&&
        car!=""&&
        mortgage!=""&&
        buy!=""){
        //alert(age+sex+region+income+married+car+mortgage+buy);
        $.get("insert.php",{age:age,
                                        sex:sex,
                                        region:region,
                                        income:income,
                                        married:married,
                                        car:car,
                                        mortgage:mortgage,
                                        buy:buy},
            function(data){
                //alert(data);
                if (data == "t") {
                    alert("插入成功");
                    location.reload();
                }
                else {
                    alert("插入失败");
                    //deleteRowInTable(id);
                }
            }
        );
    } else{
        alert("信息填写不完整");
    }

}